package edu.neusoft.springhtmldemo.mapper;

import edu.neusoft.springhtmldemo.domain.EarlyWarningLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EarlyWarningLogMapper {
    @Select("select aen.alarmNum,aen.alarmBeginTime,aen.alarmEndTime,anm.alarmDetail,aen.robotNum,aen.senserNum " +
            "from alarmlogentity aen ,alarmtypeenum anm where aen.alarmType=anm.alarmType")
    List<EarlyWarningLog> showEarlyWarningLog();

//    @Select("select * from alarmlogentity where alarmNum like '%' #{alarmNum} '%'" +
//            "and alarmBeginTime like '%' #{alarmBeginTime} '%'" +
//            "and alarmEndTime like '%' #{alarmEndTime} '%'" +
//            "and robotNum like '%' #{robotNum} '%'" +
//            "and senserNum like '%' #{senserNum} '%'")
    @Select("select aen.alarmNum,aen.alarmBeginTime,aen.alarmEndTime,anm.alarmDetail,aen.robotNum,aen.senserNum \n" +
            "from alarmlogentity aen ,alarmtypeenum anm \n" +
            "where aen.alarmType=anm.alarmType \n" +
            "and aen.alarmNum like '%' #{alarmNum} '%' \n" +
            "and aen.alarmBeginTime like '%' #{alarmBeginTime} '%'\n" +
            "and aen.alarmEndTime like '%' #{alarmEndTime} '%'\n" +
            "and anm.alarmDetail like '%' #{alarmDetail} '%'\n" +
            "and aen.robotNum like '%' #{robotNum} '%'\n" +
            "and aen.senserNum like '%' #{senserNum} '%'")
    List<EarlyWarningLog> selectEarlyWarningLog(String alarmNum, String alarmBeginTime, String alarmEndTime, String alarmDetail, String robotNum, String senserNum);
}
